<%
banner_description = @settings['banner_description'];
banner_description.force_encoding("UTF-8") if banner_description.respond_to?(:force_encoding)
%>
<!-- confirmation popup -->
<script type="text/javascript">

$("#plugin").submit(function(event) {
    var confirm_msg = "<%= l(:text_are_you_sure) %>";
    var date_range_error_msg = "<%=  l(:error_banner_date_range) %>";
    if (!checkDateRange(event, confirm_msg, date_range_error_msg)) {
       return false;
    } else {
       this.submit();
    }
});
</script>
<p>
  <%=content_tag(:label, l(:button_activate))%>
  <%=check_box_tag 'settings[enable]', true, @settings['enable'] == "true" %>
</p>

<p>
  <%=content_tag(:label, l(:label_display_authenticated_user_only))%>
  <%=check_box_tag 'settings[only_authenticated]', true, @settings['only_authenticated'] == "true" %>
</p>

<p>
  <%=content_tag(:label, l(:label_message_type))%>
  <%= radio_button_tag 'settings[type]', "info", @settings['type'] == "info" %> <span class="banner_info">Info</span><br/>
  <%= radio_button_tag 'settings[type]', "warn", @settings['type'] == "warn" %> <span class="banner_warn">Warn</span><br/>
  <%= radio_button_tag 'settings[type]', "alert", @settings['type'] == "alert" %> <span class="banner_alert">Alert </span><br/>
  <%= radio_button_tag 'settings[type]', "normal", @settings['type'] == "normal" %> <span class="banner_normal">Normal </span>
</p>

<p>
<%=content_tag(:label, l(:setting_banner_display_part))%>
<%= select_tag('settings[display_part]',
               options_for_select([[l(:label_header_only),'header'],
          [l(:label_footer_only),'footer'],[l(:label_both),'both']],@settings['display_part'])) %>
   <%=check_box_tag 'settings[display_only_login_page]', true, @settings['display_only_login_page'] == "true" %>
  <%=  l(:lalel_check_if_banner_show_only_login_page) %>
</p>

<p>
  <%=content_tag(:label, l(:label_banner_message)) %>
  <%=text_area_tag 'settings[banner_description]',  banner_description,  :size =>"40x3", 
        :class => 'wiki-edit' ,:required => true  %><br/> 
</p>       
 <%= wikitoolbar_for "settings_banner_description" %>

<%= preview_link url_for(:controller => 'banner', :action => 'preview'), 'plugin', 
  target='banner_description_preview' %>
                       
<div id="banner_description_preview" class="wiki"></div>
<p>
  <%=content_tag(:label, l(:label_use_timer))%>
  <span class="use_timer">
<%=check_box_tag 'settings[use_timer]', true, @settings['use_timer'] == "true" , :onclick => '$("#banner_timer_setting").toggle(); return false' %>
  </span>
</p>

<div id="banner_timer_setting" style="display: <%= @settings['use_timer'] == 'true' ? 'block' : 'none' %>">
  <p>
    <%=content_tag(:label, l(:label_start_datetime))%>
    <%= text_field_tag 'settings[start_ymd]', @start_datetime.strftime("%Y-%m-%d"), :size => 10 %>
    <%= select_hour @start_datetime, :prefix => 'settings', :field_name => 'start_hour', 
      :time_separator => ':', :include_seconds => false %>:
    <%= select_minute @start_datetime, :prefix => 'settings', :field_name => 'start_min', :time_separator => ':', :include_seconds => false %>
    <%= calendar_for('settings_start_ymd') %> (exp. 2012-12-31 11:00)
    <br/>
  </p>

<p>
  <%=content_tag(:label, l(:label_end_datetime))%>
    <%= text_field_tag 'settings[end_ymd]', @end_datetime.strftime("%Y-%m-%d"), :size => 10 %>
    <%= select_hour @end_datetime, :prefix => 'settings',:field_name => 'end_hour', 
      :time_separator => ':', :include_seconds => false,:disabled => !@settings['use_timer'] == "true" %>:
    <%= select_minute @end_datetime, :prefix => 'settings',:field_name => 'end_min', 
      :time_separator => ':', :include_seconds => false,:disabled => !@settings['use_timer'] == "true" %>
    <%= calendar_for('settings_end_ymd') %> (exp. 2013-01-01 11:00)
    <br/>  
</p>
</div>

<p>
  <%=content_tag(:label, l(:field_updated_on))%>
  <%= @banner_updated_on %>
</p>
